<?php
//khai bao cac object lien quan den view
$this->views["kybao"][] = "thongkebaotonvadaphathanh";
$this->views["loaibao"][] = "thongkebaotonvadaphathanh";
$this->views["thongtindatbao"][] = "thongkebaotonvadaphathanh";

$this->load->model("deliman/kybao");
$this->load->model("deliman/loaibao");
$this->load->model("deliman/khachhang");

/* Nghiep vu:
	1. Insertview duoc goi khi: mot ky bao duoc tao:
		- Chi tieu = so luong in cua ky bao do
		- Thuc giao = 0
		- Cac thong tin khac phu thuoc vao kybao
	2. Updateview duoc goi khi:
		- Thong tin kybao thay doi
		- Thong tin loaibaothaydoi
		- NV giao bao den tay khach hang, tuc khi click nut "xac nhan giao"
	3. Deleteview khi xoa 1 kybao
*/
class ModelViewThongkebaotonvadaphathanh extends Model 
{
	public function getList($where = "")
	{
		return "Thong ke so luong bao ton va da giao";
	}
	
	
	public function insertview($data)
	{
		if(count($data['khachhang']) > 0)
		{
			//insert thong tin khach hang moi vao view, voi thong tin khu vuc tu dong load	
			echo($data["khachhang"]."<br>");
			return true;
		}
		
		if(count($data['khuvuc']) > 0)
		{
			//khong lam gi ca
			return true;
		}
		return false;
	}
	
	public function updateview($data)
	{
		if(count($data['khachhang']) > 0)
		{
			//update thong tin khach hang vao view, voi thong tin khu vuc tu dong load	
			echo($data["khachhang"]."<br>");
			return true;
		}
		
		if(count($data['khuvuc']) > 0)
		{
			//update thong tin khu vuc vao view
			return true;
		}
		
		return false;
	}
	
	public function deleteview($data)
	{
		if(count($data['khachhang']) > 0)
		{
			//Xoa nhung dong khachhang id trong list	
			echo($data["khachhang"]."<br>");
			return true;
		}
		
		if(count($data['khuvuc']) > 0)
		{
			//Xoa nhung dong co khuvucid trong list
			return true;
		}
		return false;
	}
}

?>